{namespace em=TYPO3\CMS\Extensionmanager\ViewHelpers}
{namespace core=TYPO3\CMS\Core\ViewHelpers}

<f:layout name="main" />

<f:section name="headline">
	<h1><f:translate key="installedExtensions" /></h1>
</f:section>

<f:section name="content">
	<f:render partial="List/UploadForm" />

	<form class="form-inline">
		<div class="form-group">
			<f:form.textfield name="Tx_Extensionmanager_extensionkey" placeholder="{f:translate(key:'extensionList.search')}" id="Tx_Extensionmanager_extensionkey" value="{search}" class="form-control" />
		</div>
	</form>
	<br>
	<div class="table-fit">
		<table id="typo3-extension-list" class="table table-striped table-hover typo3-extension-list">
		<thead>
			<tr>
				<th title="{f:translate(key:'extensionList.header.title.update')}"><f:translate key="extensionList.header.update"/></th>
				<th title="{f:translate(key:'extensionList.header.title.activate')}"><f:translate key="extensionList.header.activate"/></th>
				<th><f:translate key="extensionList.header.extensionName"/></th>
				<th><f:translate key="extensionList.header.extensionKey"/></th>
				<th><f:translate key="extensionList.header.extensionVersion"/></th>
				<th><f:translate key="extensionList.header.extensionState"/></th>
				<th><f:translate key="extensionList.header.extensionActions"/></th>
			</tr>
		</thead>
		<tbody>
			<f:for each="{extensions}" as="extension" key="extensionKey">
				<f:if condition="{extension.terObject}">
					<f:then>
						<tr id="{extensionKey}" class="{f:if(condition:'{extension.terObject.reviewState} == -1', then:'insecure')}{f:if(condition:'{extension.terObject.reviewState} == -2', then:'outdated')} {f:if(condition:'{extension.installed}', then: '', else: 'inactive')}">
					</f:then>
					<f:else>
						<tr id="{extensionKey}" class="{f:if(condition:'{extension.installed}', then: '', else: 'inactive')}">
					</f:else>
				</f:if>
				<td>
					<f:if condition="{extension.updateAvailable}">
						<f:if condition="{extension.state} == 'excludeFromUpdates'">
							<f:then>
								<span class="btn btn-default disabled" title="{f:translate(key:'extensionList.updateDisabled')}">
									<core:icon identifier="actions-system-extension-update" />
								</span>
							</f:then>
							<f:else>
									<f:link.action action="updateCommentForUpdatableVersions"
										class="btn btn-default"
										additionalAttributes="{data-action:'update-extension'}"
										format="json" controller="Download"
										arguments="{extension:extension.key, integerVersionStart: extension.terObject.integerVersion, integerVersionStop: extension.updateToVersion.integerVersion}"
										title="{f:translate(key:'extensionList.updateToVersion', arguments:{0:extension.updateToVersion.version})}"
									>
										<core:icon identifier="actions-system-extension-update" />
									</f:link.action>
							</f:else>
						</f:if>
					</f:if>
				</td>
				<td data-order="{f:if(condition: extension.installed, then: 'active', else: 'inactive')}">
					<em:toggleExtensionInstallationState extension="{extension}" />
				</td>
				<td>
					<f:if condition="{extension.ext_icon}">
						<img class="ext-icon" src="../{extension.siteRelPath}{extension.ext_icon}" alt="{extension.title}" />
					</f:if>
					<em:configureExtension extension="{extension}" forceConfiguration="0" showDescription="1">{extension.title}</em:configureExtension>
				</td>
				<td>
					{extensionKey}
				</td>
				<td>
					{extension.version}
				</td>
				<td>
					<span class="label label-{extension.state}">{extension.state}</span>
				</td>
				<td>
					<div class="btn-group">
						<em:processAvailableActions extension="{extension}">
							<em:configureExtension class="btn btn-default" extension="{extension}" title="{f:translate(key:'extensionList.configure')}">
								<core:icon identifier="actions-system-extension-configure" />
							</em:configureExtension>
							<em:updateScript class="btn btn-default" extensionKey="{extension.key}" />
							<em:removeExtension class="btn btn-default" extension="{extension}" />
							<span class="btn btn-default">
								<f:link.action action="downloadExtensionZip" controller="Action" arguments="{extension:extension.key}" title="{f:translate(key:'extensionList.downloadzip')}">
									<core:icon identifier="actions-system-extension-download" />
								</f:link.action>
							</span>
							<em:downloadExtensionData class="btn btn-default" extension="{extension}" />
						</em:processAvailableActions>
					</div>
				</td>
				</tr>
			</f:for>
		</tbody>
	</table>
	</div>
</f:section>